const express = require('express')
const webpack = require('webpack')
const webpackDevMiddleWare = require('webpack-dev-middleware')
// 读取webpack配置
const config = require('./webpack.config')
// webpack接受后生成编译器
const complier = webpack(config)


const app = express()

app.use(webpackDevMiddleWare(complier, {
  publicPath: config.output.publicPath
}))

app.listen(3000, () => {
  console.log('server run 3000')
})